package org.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.example.domain.Information;
import org.example.domain.InformationDTO;
import org.example.service.InformationService;
import org.example.mapper.InformationMapper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author HUAWEI
* @description 针对表【information】的数据库操作Service实现
* @createDate 2025-07-26 23:26:05
*/
@Service
public class InformationServiceImpl extends ServiceImpl<InformationMapper, Information>
    implements InformationService{

    @Resource
    private InformationMapper informationMapper;

    @Override
    public List<Information> fileterList(InformationDTO informationDTO) {
        Map<String,  Object> filter = new HashMap<>();
        if (informationDTO.getDsc() != null && !informationDTO.getDsc().isEmpty()) {
            filter.put("dsc", informationDTO.getDsc());
        }
        if (informationDTO.getType() != null && !informationDTO.getType().isEmpty()) {
            filter.put("type", informationDTO.getType());
        }
        if (informationDTO.getFilter() != null && !informationDTO.getFilter().isEmpty()) {
            filter.put("filter", informationDTO.getFilter());
        }
        if (informationDTO.getValue() != null && !informationDTO.getValue().isEmpty()) {
            filter.put("value", informationDTO.getValue());
        }
        return informationMapper.fileterList(filter);
    }
}




